# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: intel-vpu-hddl
  namespace: kube-system
  labels:
    app: intel-vpu-hddl
spec:
  selector:
    matchLabels:
      app: intel-vpu-hddl
  template:
    metadata:
      labels:
        app: intel-vpu-hddl
    spec:
      containers:
      - name: intel-vpu-hddl
        image: docker
        command: ["/bin/sh"]
# run "hddl" image with non-privileged
        args: ["-c", "docker stop ov_hddl;/usr/local/bin/docker run  --name ov_hddl --rm --device-cgroup-rule='c 10:* rmw' --device-cgroup-rule='c 89:* rmw' --device-cgroup-rule='c 189:* rmw' --device-cgroup-rule='c 180:* rmw' -v /usr/src:/usr/src -v /lib/modules:/lib/modules -v /etc/modules-load.d:/etc/modules-load.d -v /dev:/dev -v /var/tmp:/var/tmp openvisualcloud/openness-ubuntu1804-analytics-hddldaemon /usr/local/bin/run_hddl.sh"]
        imagePullPolicy: IfNotPresent
        securityContext:
          readOnlyRootFilesystem: false
          privileged: true
        volumeMounts:
            - name: dockersock
              mountPath: /var/run/docker.sock
            - name: usrsrc
              mountPath: /usr/src
              readOnly: true
            - name: libmodules
              mountPath: /lib/modules
            - name: etcmodules
              mountPath: /etc/modules-load.d
            - name: vartmp
              mountPath: /var/tmp
            - name: dev
              mountPath: /dev
      volumes:
          - name: dockersock
            hostPath:
                path: /var/run/docker.sock
          - name: usrsrc
            hostPath:
                path: /usr/src
          - name: libmodules
            hostPath:
                path: /lib/modules
          - name: etcmodules
            hostPath:
                path: /etc/modules-load.d
          - name: vartmp
            hostPath:
                path: /var/tmp
          - name: dev
            hostPath: 
                path: /dev

      nodeSelector:
          hddl-zone: "yes"
